<?php
/**
 * Created by PhpStorm.
 * User: Simpson
 * Date: 2016/9/8
 * Time: 12:25
 */

namespace App\Service;

use App\Repository\UserRepository;
use Illuminate\Http\Request;

class UserService
{

    protected $user;

    public function __construct(UserRepository $user)
    {
        $this->user = $user;
    }

    /**
     * 维护预约获取联系方式、宿舍更新User表数据
     * @param Request $request
     * @return bool
     */
    public function changeUser(Request $request)
    {
        $user = \Auth::guard('wechat')->user();

        $user->cellphone = $request->input('cellphone');
        $user->short_phone = $request->input('shortphone');
        
        if($request->input('platform') == '1'){
            $user->dormitory_address = $request->input('address');
        }


        $result = $user->save();

        return $result;

    }
    
}